package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper{

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from user where username = #{username}")
    User getByUsername(String username);

    /**
     * 注册账号
     * @param user
     * @return
     */
    boolean insertReg(User user);

    /**
     * 改名
     * @param id
     * @param name
     */
    @Update("update user set name = #{name} where id = #{id}")
    void insertNameById(Long id, String name);

    /**
     * 根据id获取用户信息
     * @param id
     * @return
     */
    @Select("select * from user where id = #{id}")
    User getUserById(Long id);
}
